package mkis.service.root.data.dao;

import java.sql.SQLException;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import mkis.service.root.data.model.Bbs;

import com.ibatis.sqlmap.client.SqlMapClient;

@Repository("bbsDAO")
public class BbsDAO {
	
	@Resource(name="sqlMapClient")
	private SqlMapClient sqlMapClient;

	public int getNoticeListCnt(Map<String, Object> param) throws Exception {
		return (Integer) sqlMapClient.queryForObject("bbs.getNoticeListCnt", param);
	}

	public List<Bbs> getNoticeList(Map<String, Object> param) throws Exception {
		return sqlMapClient.queryForList("bbs.getNoticeList", param);
	}

	public Bbs getNotice(String boardSeq) throws Exception {
		return (Bbs) sqlMapClient.queryForObject("bbs.getNotice", boardSeq);
	}

	public int deleteNotice(List<String> boardSeqList) throws Exception {
		return (int) sqlMapClient.delete("bbs.deleteNotice", boardSeqList);
	}

	public Object insertNotice(Bbs bbs) throws Exception {
		return sqlMapClient.insert("bbs.insertNotice",bbs);
	}
	
	public int updateNotice(Bbs bbs) throws Exception {
		return sqlMapClient.update("bbs.updateNotice",bbs);
	}
}
